<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>建设单位详情</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="/static/css/buildUnit/common.css">
    <style>
        body {
            height: auto;
        }

        .personInfo {
            display: none;
        }

        .content {
            padding: 10px;
            padding-top: 0;
            max-width: 1000px;
        }

        .layui-form-checkbox[lay-skin=primary] span {
            color: #3366CC;
        }

        .editBox {
            display: none;
        }

        .detail td > .layui-input {
            border-width: 0;
        }

        .jgInfo {
            display: none;
        }
    </style>
</head>
<body>
<div class="content">
    <!--机构信息-->
    <form class="layui-form layui-form-pane" action="" lay-filter="example">
        <table class="layui-table v-table">
            <tbody>
            <tr style="display: none;">
                <td class="th8 required">建设单位类型</td>
                <td colspan="3">
                    <input type="radio" name="typeItem" value="2010" class="item2010" lay-filter="typeItem"
                           title="企业（有营业执照）" checked>
                    <input type="radio" name="typeItem" value="2020" class="item2020" lay-filter="typeItem"
                           title="临时机构">
                    <input type="radio" name="typeItem" value="2030" class="item2030" lay-filter="typeItem" title="个人">
                </td>
            </tr>
            <tr class="code">
                <td class="th8 required" style="color:red;">
                    <p style="color:#000;">组织机构代码</p>
                    (登录账号)
                </td>
                <td class="orgCodeBox" colspan="3">
                    <input type="text" name="code" required lay-verify="required" placeholder=""
                           autocomplete="off"
                           class="layui-input orgCode">
                </td>
            </tr>
            <tr class="jgInfo">
                <td class="th8 required">单位名称</td>
                <td>
                    <input type="text" name="name" required lay-verify="required" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
                <td class="th8 required">工商登记类型</td>
                <td>
                    <select name="orgRegistryType" id="orgRegistryType" lay-filter="orgRegistryType"
                            lay-verify="required">
                        <option value=""></option>
                    </select>
                </td>
            </tr>
            <tr class="jgInfo">
                <td class="th8">单位联系电话</td>
                <td colspan="3">
                    <input type="text" name="orgLinkPhone" lay-verify="linkPhone" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
            </tr>
            <tr class="jgInfo">
                <td class="th8 required">法人代表</td>
                <td colspan="3">
                    <input type="text" name="legalManName" lay-verify="required" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
            </tr>
            <tr class="jgInfo">
                <td class="th8 required">法人代表手机</td>
                <td>
                    <input type="text" name="legalManMobile" lay-verify="required|phone" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
                <td class="th8">法人代表邮箱</td>
                <td>
                    <input type="text" name="legalManEmail" lay-verify="email" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
            </tr>
            <tr>
                <td class="th8 required">联系人</td>
                <td colspan="3">
                    <input type="text" name="linkManName" lay-verify="required" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
            </tr>
            <tr>
                <td class="th8 required">联系人手机</td>
                <td>
                    <input type="text" name="linkManMobile" lay-verify="required|phone" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
                <td class="th8 required">联系人邮箱</td>
                <td>
                    <input type="text" name="linkManEmail" lay-verify="required|email" placeholder=""
                           autocomplete="off"
                           class="layui-input">
                </td>
            </tr>
            <tr class="areaTr">
                <td class="th8 required">单位注册属地</td>
                <td colspan="3">
                    <div class="layui-input-inline">
                        <select name="regProvince" id="regProvince" lay-filter="regProvince">
                            <option value=""></option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="regCity" id="regCity" lay-filter="regCity">
                            <option value=""></option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="regCountry" id="regCountry" lay-filter="regCountry">
                            <option value=""></option>
                        </select>
                    </div>
                </td>
            </tr>
            <tr class="jgInfo">
                <td class="th8">单位办公地址</td>
                <td colspan="3">
                    <div class="layui-input-inline">
                        <select name="province" id="province" lay-filter="province">
                            <option value=""></option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="city" id="city" lay-filter="city">
                            <option value=""></option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="country" id="country" lay-filter="country">
                            <option value=""></option>
                        </select>
                    </div>
                    <div>
                        <input style="width:640px;margin:5px 0;" type="text" name="address" lay-verify=""
                               placeholder=""
                               autocomplete="off"
                               class="layui-input">
                    </div>
                </td>
            </tr>
            <tr class="jgInfo">
                <td class="th8">单位简介</td>
                <td colspan="3">
                    <textarea name="orgIntro" id="" cols="30" rows="10" style="width:100%;"></textarea>
                </td>
            </tr>
            <tr>
                <td class="th8 required">附件信息</td>
                <td colspan="3">
                    <div class="fjBzBox">
                        <p><span>1</span>、单位有效证件（统一社会信用代码证、营业执照副本或事业单位法人证书等）→复印→盖章→扫描或拍照；</p>
                        <p><span>2</span>、联系人身份证明（身份证等）→证件正反面复印到一张A4纸→盖章（公章）→扫描或拍照；</p>
                        <p>注：照片完整、文字清晰可辨，照片格式为"jpg格式"或"png格式"，扫描分辨率100DPI即可，单张图片不要超过2M。</p>
                    </div>
                    <div>
                        <iframe src="" frameborder="0" class="attachmentList" name="attachmentList"
                                style="height:120px;"></iframe>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div style="text-align: center" class="btnBox">
            <button class="demo1 saveBox layui-btn layui-btn-disabled layui-btn-normal" lay-filter="demo1" lay-submit
                    style="display: none;">
                提交注册
            </button>
            <button class="cancelBtn saveBox layui-btn layui-btn-disabled layui-btn-primary" type="button"
                    style="display: none;">
                取消取消
            </button>
            <button class="editBox layui-btn layui-btn-disabled layui-btn-normal" type="button">修改</button>
        </div>
    </form>
</div>
<script src="/static/js/main.js"></script>
<script type="text/javascript">
    layui.use(['jquery', 'form', 'jsDictFile', 'configure', 'configureCom', 'selectFun', 'bluebird'], function () {
        var form = layui.form;
        var jsDictFile = layui.jsDictFile;
        var configure = layui.configure;
        var configureCom = layui.configureCom;
        var selectFun = layui.selectFun;
        window.$ = layui.jquery;
        //工商登记类型
        $.each(jsDictFile.orgRegistryType, function (index, item) {
            selectFun.appendOptionTo($('form').find('select#orgRegistryType'), item.name, item.value, '');
        });
        //初始化赋值
        var data = {
            organizationId: getId
        };
        configureCom.getAjax(configure.ORGANIZATION_HTTP + getId, data).then(function (res) {
            var data = res.result;

            form.val('example', data);
            form.render();
        });

        //是否同意提示信息
        form.on('checkbox(isAgree)', function (data) {
            var isAgree = data.elem.checked;//是否被选中，true或者false
            if (isAgree) {
                $('.demo1').attr('disabled', false).removeClass('layui-btn-disabled');
                form.render();
            } else {
                $('.demo1').attr('disabled', true).addClass('layui-btn-disabled');
                form.render();
            }
        });

        //保存信息
        form.on('submit(demo1)', function (data) {
            var data = data.field;
            // 如果是个人 验证身份证号
            if (data.typeItem == '2030') {
                var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                if (!reg.test(data.code)) {
                    var msg = '请输入正确的身份证号';
                    top.layer.msg(msg);
                    return false;
                }
            }
            if (!(data.regProvince && data.regCity && data.regCountry)) {
                var msg = '请选择单位注册属地';
                top.layer.msg(msg);
                return false;
            }
            if ($('.rePassword').val() != $('.password').val()) {
                var msg = '两次输入的密码不一致';
                top.layer.msg(msg);
                return false;
            }

            data.type = infoType;//1010建设单位 1020审查机构
            data.activated = activated;
            data.id = id;
            //获取附件信息
            window.frames["attachmentList"].window.getAttaList(function (result) {
                //判断必传
                if (result.length < 1) {
                    top.layer.msg('请上传附件');
                    return false;
                }
                data.dataAttachmentDTOList = [{
                    attachmentFileDTOList: result
                }];
                configureCom.postAjax(configure.ORGANIZATION_EDIT_HTTP, JSON.stringify(data)).then(function (res) {
                    if (res.code == 1) {
                        top.layer.msg('修改成功');
                    } else {
                        top.layer.msg(res.msg);
                    }
                });
            });
            return false;
        });
    });

</script>
</body>
</html>
